<rd-header>
  <rd-header-title title-text="Create container instance"></rd-header-title>
  <rd-header-content>
    <a ui-sref="azure.containerinstances">Container instances</a> &gt; Add container
  </rd-header-content>
</rd-header>

<div class="row">
  <div class="col-sm-12">
    <rd-widget>
      <rd-widget-body>
        <form class="form-horizontal" autocomplete="off">
          <div class="col-sm-12 form-section-title">
            Azure settings
          </div>
          <!-- subscription-input -->
          <div class="form-group">
            <label for="azure_subscription" class="col-sm-1 control-label text-left">Subscription</label>
            <div class="col-sm-11">
              <select class="form-control" name="azure_subscription" ng-model="state.selectedSubscription" ng-options="subscription.Name for subscription in subscriptions" ng-change="changeSubscription()"></select>
            </div>
          </div>
          <!-- !subscription-input -->
          <!-- resourcegroup-input -->
          <div class="form-group">
            <label for="azure_resourcegroup" class="col-sm-1 control-label text-left">Resource group</label>
            <div class="col-sm-11">
              <select class="form-control" name="azure_resourcegroup" ng-model="state.selectedResourceGroup" ng-options="resourceGroup.Name for resourceGroup in resourceGroups"></select>
            </div>
          </div>
          <!-- !resourcegroup-input -->
          <!-- location-input -->
          <div class="form-group">
            <label for="azure_location" class="col-sm-1 control-label text-left">Location</label>
            <div class="col-sm-11">
              <select class="form-control" name="azure_location" ng-model="model.Location" ng-options="location for location in locations"></select>
            </div>
          </div>
          <!-- !location-input -->
          <div class="col-sm-12 form-section-title">
            Container configuration
          </div>
          <!-- name-input -->
          <div class="form-group">
            <label for="container_name" class="col-sm-1 control-label text-left">Name</label>
            <div class="col-sm-11">
              <input type="text" class="form-control" ng-model="model.Name" name="container_name" placeholder="e.g. myContainer">
            </div>
          </div>
          <!-- !name-input -->
          <!-- image-input -->
          <div class="form-group">
            <label for="image_name" class="col-sm-1 control-label text-left">Image</label>
            <div class="col-sm-11">
              <input type="text" class="form-control" ng-model="model.Image" name="image_name" placeholder="e.g. nginx:alpine">
            </div>
          </div>
          <!-- !image-input -->
          <!-- os-input -->
          <div class="form-group">
            <label for="container_os" class="col-sm-1 control-label text-left">OS</label>
            <div class="col-sm-11">
              <select class="form-control" ng-model="model.OSType" name="container_os">
                <option value="Linux">Linux</option>
                <option value="Windows">Windows</option>
              </select>
            </div>
          </div>
          <!-- !os-input -->
          <!-- port-mapping -->
          <div class="form-group">
            <div class="col-sm-12">
              <label class="control-label text-left">Port mapping</label>
              <span class="label label-default interactive" style="margin-left: 10px;" ng-click="addPortBinding()">
                <i class="fa fa-plus-circle" aria-hidden="true"></i> map additional port
              </span>
            </div>
            <!-- port-mapping-input-list -->
            <div class="col-sm-12 form-inline" style="margin-top: 10px;">
              <div ng-repeat="binding in model.Ports" style="margin-top: 2px;">
                <!-- host-port -->
                <div class="input-group col-sm-4 input-group-sm">
                  <span class="input-group-addon">host</span>
                  <input type="text" class="form-control" ng-model="binding.host" placeholder="e.g. 80">
                </div>
                <!-- !host-port -->
                <span style="margin: 0 10px 0 10px;">
                  <i class="fa fa-long-arrow-alt-right" aria-hidden="true"></i>
                </span>
                <!-- container-port -->
                <div class="input-group col-sm-4 input-group-sm">
                  <span class="input-group-addon">container</span>
                  <input type="text" class="form-control" ng-model="binding.container" placeholder="e.g. 80">
                </div>
                <!-- !container-port -->
                <!-- protocol-actions -->
                <div class="input-group col-sm-3 input-group-sm">
                  <div class="btn-group btn-group-sm">
                    <label class="btn btn-primary" ng-model="binding.protocol" uib-btn-radio="'TCP'">TCP</label>
                    <label class="btn btn-primary" ng-model="binding.protocol" uib-btn-radio="'UDP'">UDP</label>
                  </div>
                  <button class="btn btn-sm btn-danger" type="button" ng-click="removePortBinding($index)">
                    <i class="fa fa-trash" aria-hidden="true"></i>
                  </button>
                </div>
                <!-- !protocol-actions -->
              </div>
            </div>
            <!-- !port-mapping-input-list -->
          </div>
          <!-- !port-mapping -->
          <!-- public-ip -->
          <div class="form-group">
            <div class="col-sm-12">
              <label for="public_ip" class="control-label text-left">
                Allocate public IP address
              </label>
              <label class="switch" style="margin-left: 20px;">
                <input type="checkbox" name="public_ip" ng-model="model.AllocatePublicIP"><i></i>
              </label>
            </div>
          </div>
          <!-- public-ip -->
          <div class="col-sm-12 form-section-title">
            Container resources
          </div>
          <!-- cpu-input -->
          <div class="form-group">
            <label for="container_cpu" class="col-sm-1 control-label text-left">CPU</label>
            <div class="col-sm-11">
              <input type="number" class="form-control" ng-model="model.CPU" name="container_cpu" placeholder="1">
            </div>
          </div>
          <!-- !cpu-input -->
          <!-- memory-input -->
          <div class="form-group">
            <label for="container_memory" class="col-sm-1 control-label text-left">Memory</label>
            <div class="col-sm-11">
              <input type="number" class="form-control" ng-model="model.Memory" name="container_memory" placeholder="1">
            </div>
          </div>
          <!-- !memory-input -->
          <!-- actions -->
          <div class="col-sm-12 form-section-title">
            Actions
          </div>
          <div class="form-group">
            <div class="col-sm-12">
              <button type="button" class="btn btn-primary btn-sm" ng-disabled="state.actionInProgress" ng-click="create()" button-spinner="state.actionInProgress">
                <span ng-hide="state.actionInProgress">Deploy the container</span>
                <span ng-show="state.actionInProgress">Deployment in progress...</span>
              </button>
            </div>
          </div>
          <!-- !actions -->
        </form>
      </rd-widget-body>
    </rd-widget>
  </div>
</div>
